package com.ruoyi.web.controller.analysiswarning;

import com.ruoyi.analysiswarning.domain.ScriptApp;
import com.ruoyi.analysiswarning.service.IScriptAppService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.devops.domain.HistoryReports;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(("/scriptappcontroller"))
public class ScriptAppController {

    @Autowired
    IScriptAppService scriptAppService;

    // 查询脚本
    @PostMapping("/queryScriptAppByType")
    public AjaxResult queryScriptAppByType(String type,String status) {
        List<ScriptApp> list = scriptAppService.queryScriptAppByType(type,status);
        return AjaxResult.success(list);
    }

    // 查询脚本（type 7 8 9）
    @PostMapping("/queryScriptAppByTypeNew")
    public AjaxResult queryScriptAppByTypeNew(String type) {
        List<ScriptApp> list = scriptAppService.queryScriptAppByTypeNew(type);
        return AjaxResult.success(list);
    }
    // 脚本执行
    @PostMapping("/updateScriptAppById")
    public AjaxResult updateScriptAppById(Integer id,Integer state) {
        int a  = scriptAppService.updateScriptAppById(id,state);
        return AjaxResult.success(a);
    }

}
